<template>
  <div>
    <van-nav-bar
      title="设置昵称"
      left-text="取消"
      right-text="完成"
      @click-left="$emit('close')"
      @click-right="onClickRight"
    />
    <div class="field">
      <van-field
        v-model="name"
        rows="2"
        autosize
        type="textarea"
        maxlength="10"
        placeholder="请输入昵称"
        show-word-limit
      />
    </div>
  </div>
</template>
           
<script>
 import {editUserprofile_api} from "@/api/article/index";
export default {
  data() {
    return {
      name: ""
    };
  },
  methods: {
    //点击完成
  async  onClickRight() {
       const {data:res}=await editUserprofile_api({
           name:this.name
       })
      //  console.log(res,'eeeee');
       this.$emit('nickname',res.data.name)
       //关闭弹层
    }
  }
};
</script>
<style scoped lang="less">
.van-field {
  padding: 20px;
}
.field {
    padding: 20px;
}
</style>
